package nl.vddijssel.social.login.client.activity;

import nl.vddijssel.social.client.ClientFactory;
import nl.vddijssel.social.client.place.InitPlace;
import nl.vddijssel.social.login.client.LoginFactory;
import nl.vddijssel.social.login.client.view.LoginView;

import com.google.gwt.activity.shared.AbstractActivity;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.place.shared.Place;
import com.google.gwt.user.client.ui.AcceptsOneWidget;

public class LoginInitActivity extends AbstractActivity implements LoginView.Presenter {
	
	private ClientFactory clientFactory;
	private LoginFactory loginFactory;
	private InitPlace place;
	
	public LoginInitActivity(InitPlace place,ClientFactory clientFactory,LoginFactory loginFactory){
		this.place = place;
		this.clientFactory = clientFactory;
		this.loginFactory = loginFactory;
	}

	@Override
	public void start(AcceptsOneWidget panel, EventBus eventBus) {
		LoginView loginView = loginFactory.getLoginView();
		loginView.setPresenter(this);
		panel.setWidget(loginView);
	}

	@Override
	public void goTo(Place place) {
		clientFactory.getPlaceController().goTo(place);
	}

}
